package com.aabte.design.pattern.behavioral.interpreter;

public class AddInterpreter implements Interpreter {

    private Interpreter firstExpresstion, secondExpresstion;

    public AddInterpreter(Interpreter firstExpresstion, Interpreter secondExpresstion) {
        this.firstExpresstion = firstExpresstion;
        this.secondExpresstion = secondExpresstion;
    }

    @Override
    public int interpret() {
        return this.firstExpresstion.interpret() + this.secondExpresstion.interpret();
    }

    @Override
    public String toString() {
        return "+";
    }
}
